package com.crm.manager.controller;

import com.crm.common.core.domain.R;
import com.crm.manager.domain.dto.BusinessPageDTO;
import com.crm.manager.domain.dto.TimeDto;
import com.crm.manager.domain.vo.BaseInfoVO;
import com.crm.manager.service.IndexService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IndexService indexService;

    @GetMapping()
    public R<BaseInfoVO> getBaseInfo(TimeDto dto){
        return R.ok(indexService.getBaseInfo(dto));
    }

    @GetMapping("/businessChangeStatistics")
    public R<List<Map>> getBusinessChangeStatistics(TimeDto dto){
        return R.ok(indexService.getBusinessChangeStatistics(dto));
    }

    @GetMapping("/salesStatistic")
    public R<List<Map>> getSalesStatistic(TimeDto dto){
        return R.ok(indexService.salesStatistic(dto));
    }


}
